package com.neusoft.training.podcast.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neusoft.training.podcast.entity.Category;
import com.neusoft.training.podcast.mapper.CategoryMapper;
import com.neusoft.training.podcast.service.CategoryService;

@Service
public class CategoryServiceImpl implements CategoryService{
	
	@Autowired
	private CategoryMapper CategoryMapper;
	
	@Override
	//插入新的分类
	public void addCategory(String categoryName,String type) {
		CategoryMapper.addCatagory(categoryName, type);
	}
	
	@Override
	//删除分类
	public void deleteCategory(Integer catagoryID) {
		CategoryMapper.deleteCategory(catagoryID);
	}
	
	@Override
	//显示所有分类
	public List<Category> findAllCategories(){
		return CategoryMapper.findAllCategories();
	}

	@Override
	public String findCategoryByID(Integer categoryID) {
		
		return CategoryMapper.findCategoryIDbyName(categoryID);
	}
	
	//后端逻辑添加 author：llx
		@Override
		public List<Category> findFavouriteCategories(Integer userID) {
			// TODO Auto-generated method stub
			return CategoryMapper.findFavouriteCategory(userID);
		}

		@Override
		public List<Category> findPersonVideoCategory(Integer userID) {
			// TODO Auto-generated method stub
			return CategoryMapper.findPersonVideoCategory(userID);
		}

		@Override
		public List<Category> findCommentVideoCategory(Integer userID) {
			// TODO Auto-generated method stub
			return CategoryMapper.findCommentVideoCategory(userID);
		}
		
		@Override
		public Category findCategoryName(Integer categoryID) {
			return CategoryMapper.findCategoryName(categoryID);
		}
	

}
